package com.jycrm.presentation.components.tree;

import java.util.ArrayList;
import java.util.List;


public class Folder extends Item implements java.io.Serializable {
    
    /** serialVersionUID */
    private static final long serialVersionUID = 7097320612652218327L;
    private List folders = new ArrayList();
    private List items = new ArrayList();
    private boolean expand;
    
    /**
     * Creates a new folder
     * @param name
     */
    public Folder(String id,String name,int level)
    {
        super(id,name,level);
    }
    
    public Folder(String id,String name,int level,boolean checked)
    {
        super(id,name,level,checked);
    }

    /**
     * Create new folder with parent
     * @param parent
     * @param name
     */
    public Folder(Folder parent, String id,String name,int level)
    {
        super(parent,id, name,level);
    }
    
    public Folder(Folder parent, String id,String name,int level,boolean checked)
    {
        super(parent,id, name,level,checked);
    }

    /**
     * New folder with name
     * @param name
     * @return
     */
    public Folder folder(String id,String name,int level)
    {
        Folder f = new Folder(this,id, name,level);
        folders.add(f);
        return f;
    }
    public Folder folder(String id,String name,int level,boolean checked)
    {
        Folder f = new Folder(this,id, name,level,checked);
        folders.add(f);
        return f;
    }
    

    /**
     * Creates folder item
     * @param name
     * @return
     */
    public Item item(String id,String name,int level)
    {
        Item i = new Item(this,id,name,level);
        items.add(i);
        return i;
    }
    
    public Item item(String id,String name,int level,boolean checked)
    {
        Item i = new Item(this,id,name,level,checked);
        items.add(i);
        return i;
    }

    /**
     * Returns list of folders
     * @return
     */
    public List getFolders()
    {
        return folders;
    }

    /**
     * List of items
     * @return
     */
    public List getItems()
    {
        return items;
    }

    /**
     * Debug string
     * {@inheritDoc}
     */
    public String toString()
    {
        return "Folder " + getName();
    }
    /**
     * @return Returns the expand.
     */
    public boolean isExpand(){
        return expand;
    }


    
    /**
     * @param expand The expand to set.
     */
    public void setExpand(boolean expand){
        this.expand=expand;
    }

    
    
}